
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!--    <meta charset=utf-8">-->
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>数据库后台</title>
    <!-- BOOTSTRAP STYLES-->
    <link href="../css/bootstrap.min.css" rel="stylesheet" />
    <!-- CUSTOM STYLES-->
    <link href="../css/custom.css" rel="stylesheet" />
    <!-- /. WRAPPER  -->
    <script src="../js/jquery.js"></script>
<!--    <script src="../js/common.js"></script>-->
    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
    <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>

</head>

<body>
<div id="wrapper">
    <nav class="navbar navbar-default navbar-cls-top " role="navigation"
         style="margin-bottom: 0">
        <div class="navbar-header">
            <a class="navbar-brand">数据反馈</a>
        </div>
        <div
                style="color: white; padding: 15px 50px 5px 50px; float: right; font-size: 16px;">
            <!--            <form action="../loginOut.jsp" method="post">-->
            <button id = "loginout" class="btn btn-danger">注销</button>
            <!--            </form>-->

        </div>
    </nav>
    <!-- /. NAV TOP  -->
    <nav class="navbar-default navbar-side" role="navigation">
        <div class="sidebar-collapse">
            <ul class="nav" id="main-menu">
                <li><a href="wenzhang.html"><i class="fa fa-qrcode fa-3x"></i>文章添加</a></li>
                <li><a href="wenzhangchaxun.html"><i class="fa fa-bar-chart-o fa-3x"></i> 文章管理</a></li>
            </ul>
        </div>
    </nav>
    <!-- /. NAV SIDE  -->
    <div id="page-wrapper">
        <div id="page-inner">

            <div class="container">
                <fieldset>
                    <legend>数据反馈</legend>
                    <p>
                        <input type="button" id="searchlist" class="btn btn-primary" value="查找" />
<!--                        <input type="button" id="downloadlist" class="btn btn-primary" value="下载" />-->
                    </p>

                    <div class="row" style="padding: 50px 20px 0px 20px">

                        <div class="table-responsive">
                            <table class="table table-striped" id="table1"
                                   style="text-align: center">
                                <thead>
                                <td>id</td>
                                <td>标题</td>
                                <td>时间</td>
                                <td>操作</td>
                                </thead>
                                <tbody>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </fieldset>
            </div>
            <!-- /. PAGE INNER  -->
        </div>
        <!-- /. PAGE WRAPPER  -->
    </div>

</div>


    <script type="text/javascript">
        $(document).ready(function () {


            $("#searchlist").click(function () {
                let d1 = {
                    temp: "temp",
                };
                $.ajax({
                    type: "POST",
                    url: "../ArticleList",
                    contentType: "application/json;charset=utf-8",
                    data: JSON.stringify(d1),
                    dataType: "json",
                    success: function (data) {
                        if (data == null) {
                            alert("无权限")
                        } else {
                            $('table tbody').html('');
                            $.each(data, function (i, item) {
                                var rowmsg = "<tr id= align='center'>"
                                    + "<td>" + item.title + "</td>"
                                    + "<td>" + item.mainbody + "</td>"
                                    + "<td>" + item.date + "</td>";
                                    rowmsg = rowmsg +  "<td>"
                                    + "<button type='button' class='btn btn-success' value="+item.id +">修改</button>"
                                    + "<button type='button' class='btn btn-danger'  value="+item.id +">删除</button>"
                                    +"</td>";
                                rowmsg = rowmsg + "</tr>";
                                $("#table1").append(rowmsg);
                            })
                        }
                    },
                    error: function (data) {
                        // window.location.href = "/msgtable/html/login.html"
                        alert("无资源")
                    }
                }); 
            });

            $(document).on('click','.btn-success',function(){
                alert(0+$(this).val())
            });
            $(document).on('click','.btn-danger',function(){
                alert(1)
            });



        });
    </script>

</body>
</html>